<!-- 打印 -->
<template>
	<div>
		<slot></slot>
	</div>
</template>

<script>
export default {
	methods: {
		printContent() {
			const printWindow = window.open('', '', 'height=600,width=800');
			printWindow.document.write('<html><head><title>Print</title>');
			printWindow.document.write('</head><body>');
			printWindow.document.write(this.getPrintContent()); // 获取打印内容
			printWindow.document.write('</body></html>');
			printWindow.document.close();
			printWindow.print();
			printWindow.close();
		},
        
		getPrintContent() {
			return this.$slots.default ? this.$slots.default() : '<p>没有内容可打印</p>';
		},
	},
};
</script>

<style scoped></style>
